package edu.depaul.se.courseregistration.webservice;

import edu.depaul.se.courseregistration.jpa.Address;
import edu.depaul.se.courseregistration.jpa.user.Person;
import edu.depaul.se.courseregistration.jpa.user.Admin;
import edu.depaul.se.courseregistration.jpa.user.DBAdmin;
import edu.depaul.se.courseregistration.jpa.user.Professor;
import edu.depaul.se.courseregistration.jpa.user.Student;
import edu.depaul.se.courseregistration.jpa.user.Registrar;
import edu.depaul.se.courseregistration.sessionbean.AdminSession;
import javax.ejb.EJB;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.ejb.Stateless;

//@WebService(serviceName = "AdminService")
@Stateless()
public class AdminService {
    
    @EJB
    private AdminSession adminSession;
    
    //Because of all the parameters for different students, this method is 
    //  overridable depending on the person type.
    
    //Access to Create, Remove, Update Person
   // method for student
    @WebMethod(operationName = "CreatePerson")
    public Person CreatePerson(@WebParam (name = "personType") String personType,
                               @WebParam (name = "address") String strAddress,
                               @WebParam (name = "city") String city,
                               @WebParam (name = "state") String state,
                               @WebParam (name = "zip") String zip,
                               @WebParam (name = "major") String major,
                               @WebParam (name = "departmentName") String deptName,
                               @WebParam (name = "firstName") String firstName,
                               @WebParam (name = "lastName") String lastName,
                               @WebParam (name = "email") String email,
                               @WebParam (name = "personId") int personId) {
       
        
       return adminSession.createPerson(personType, strAddress, city, state, zip, major, deptName, firstName, lastName, email, personId); 
       
            
       
   }
    
    @WebMethod(operationName = "EditPerson")
    public void EditPerson(@WebParam (name = "personType") String personType,
                               @WebParam (name = "address") String strAddress,
                               @WebParam (name = "city") String city,
                               @WebParam (name = "state") String state,
                               @WebParam (name = "zip") String zip,
                               @WebParam (name = "major") String major,
                               @WebParam (name = "departmentName") String deptName,
                               @WebParam (name = "firstName") String firstName,
                               @WebParam (name = "lastName") String lastName,
                               @WebParam (name = "email") String email,
                               @WebParam (name = "personId") int personId) {
       
       adminSession.editPerson(personType, strAddress, city, state, zip, major, deptName, firstName, lastName, email, personId); 
     
    }
    
    @WebMethod(operationName = "RemovePerson")
    public void RemovePerson(@WebParam (name = "personID") int personID) {
        adminSession.removePerson(personID);
   }
}
